//
//  ViewController.m
//  02- UIImageView Animation
//
//  Created by 冀永金 on 16/7/15.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (nonatomic, strong) NSMutableArray *ImagesMarr;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createImages];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)createImages {
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.view.frame];
    imageView.image = [UIImage imageNamed:@"flower1.tiff"];
    [self.view addSubview:imageView];
    self.ImagesMarr = [NSMutableArray array];
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20, 50, 100, 80)];
    [self.view addSubview:image];
    imageView.image = [UIImage imageNamed:@"BackGround.png"];
    for (int i = 1; i < 19; i++) {
        NSString *name = [NSString stringWithFormat:@"flower%d.tiff",i];
        UIImage *image = [UIImage imageNamed:name];
        [_ImagesMarr addObject:image];
    }
    image.animationImages = _ImagesMarr;
    image.animationDuration = 1;
    image.animationRepeatCount = 0;
    [image startAnimating];
    [UIView animateWithDuration:5 animations:^{
        image.frame = CGRectMake(300, 50, 200, 100);
    }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
